﻿using System;
using com.yoozoo.gta.Gameplay.PVE;
using UnityEditor;
using UnityEngine;

namespace NpcFramework
{
    [CanEditMultipleObjects]
    public class NpcBrithPointDataSO : ScriptableObject
    {
        public SceneSeparateManager.SceneSeparateType SeparateType = SceneSeparateManager.SceneSeparateType.None;
        public GameObject m_graph;
        public NpcBrithPointData npcBrithPointData;
       
        
        private void OnValidate()
        {
            if (this.npcBrithPointData != null)
            {
                if (SeparateType == SceneSeparateManager.SceneSeparateType.LibertyScene)
                {
                    if (this.m_graph)
                        this.npcBrithPointData.BTreePath = AssetDatabase.GetAssetPath(m_graph);
                }
                else
                {

                }
            }

        }

        public void LoadBTreeByData()
        {
            
            if (this.npcBrithPointData != null && this.npcBrithPointData.BTreePath != String.Empty)
            {
                if (SeparateType == SceneSeparateManager.SceneSeparateType.LibertyScene)
                {
                    m_graph = AssetDatabase.LoadAssetAtPath<GameObject>(this.npcBrithPointData.BTreePath);
                }
                else
                {
                }
            }
            
        }
    }
}
